-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MAINT: Enforce PLW2901 (avoid loop/context var overwrite) #3513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3513 +/- ##
=======================================
Coverage 97.11% 97.11%
=======================================
Files 57 57
Lines 9713 9720 +7
Branches 1758 1758
=======================================
+ Hits 9433 9440 +7
Misses 168 168
Partials 112 112 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I have left some remarks for specific changes and some general ones.
|
Hi @stefan6419846 I addressed all the comments. |
| while isinstance(d_font, IndirectObject): | ||
| d_font = d_font.get_object() | ||
| self.font_dictionary["/DescendantFonts"][d_font_idx] = d_font | ||
| if isinstance(d_font, IndirectObject): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need this check. Calling d_font.get_object() should always work.
pypdf/_page.py
Outdated
| v = ArrayObject( | ||
| [self._translate_value_inline_image(k, x) for x in v] | ||
| value_for_init = cast( | ||
| PdfObject, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayObject is a PdfObject. If you want to type value_for_init, please use value_for_init: PdfObject = ... without the cast.
pypdf/_writer.py
Outdated
| # other cases will be updated through the for loop | ||
| annotation[NameObject(AA.AS)] = v | ||
| annotation[NameObject(FA.V)] = v | ||
| if flatten and appearance_stream_obj is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this code originate from?
pypdf/_writer.py
Outdated
| if isinstance(value, PdfObject): | ||
| value = value.get_object() | ||
| args[NameObject(key)] = create_string_object(str(value)) | ||
| value_obj = value.get_object() if isinstance(value, PdfObject) else value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| value_obj = value.get_object() if isinstance(value, PdfObject) else value | |
| value_object = value.get_object() if isinstance(value, PdfObject) else value |
| if isinstance(params, NullObject): | ||
| params = {} | ||
| for filter_name, params_untyped in zip(filters, decode_parms): | ||
| params_typed: Optional[DictionaryObject] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not params directly to reduce the diff?
| """ | ||
| ) | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is most likely wrong.
Summary
Contribution by Gittensor, learn more at https://gittensor.io/